#include <iostream>
#include <fstream>
#include <unistd.h>
using namespace std;
#define STRING "ASDFASDFASDFASDFASDFDSF"
#define PATH_NAME "./1.log"
int main(){
	int check = access( PATH_NAME ,F_OK);
	printf( "check is %d\n" , check);
	exit(0); 
	
	fstream file;
	file.open( PATH_NAME , ios::out|ios::binary|ios::in );
	if( !file.is_open() ){
		cout <<"Entry if" <<endl;
		file.open( PATH_NAME , ios::out );
		if( file.bad()){

			cout << "bad" <<endl;
		}
		if( file.fail()){
			cout << "fail" <<endl;
		}
		cout << hex <<file.rdstate()<<endl;

		if( !file.is_open() ){
			cout <<"Entry if if 1" <<endl;
			cout <<"file error"<<endl;
			return 0;
		}
		file.close();
		file.open( PATH_NAME , ios::out|ios::in|ios::binary );
		if( !file.is_open() ){
			cout << "Entry if if 2" <<endl;
			cout <<"file error" <<endl;
			return 0;
		}
	
	}
	
	file.seekg( 0 , ios::beg);
//	file.write( STRING , strlen(STRING) );


	char buf[4];
	memset(buf, 0 ,4);
	file.read(buf , 3);
	cout << file.gcount() <<endl;
	printf("%s\n",buf);
//	cout << buf <<endl;
	file.close();
	return 0;

}
